//引入路由
import { createRouter, createWebHashHistory } from "vue-router"



//声明路由配置
let routes = [

    {
        path: '/',
        component: () => import("../pages/home/index.vue"),
        name:'/',
        meta:{
            name:"首页"
        },
        children: [
            {
                path: 'discover',
                component: () => import('../pages/discover/index.vue'),
                redirect: '/discover/playlist',
                name:"discover",
                meta:{
                    name:"发现"
                },
                children: [
                    {
                        path: 'playlist',
                        component: () => import('../pages/discover/playlist/index.vue'),
                        name:"playlist",
                        meta:{
                            name:"歌单"
                        }
                    }
                ]
            },
            {
                props: true,
                path: 'friend/:id',
                component: () => import('../pages/friend/index.vue'),
                name:"friend",
                meta:{
                    name:"朋友"
                }
            },
            {
                path: 'mine',
                component: () => import('../pages/mine/index.vue'),
                name:"mine",
                meta:{
                    name:"个人中心"
                }
            },
        ]
    },
    {
        path: '/login',
        component: () => import('../pages/login/index.vue')
    }
]

// 创建路由
const router = createRouter({
    // 路由模式
    history: createWebHashHistory(),
    routes
})


// 导出路由
export default router